<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        var phoneNumber=prompt("倾输入你的手机号")
        //通过length属性可以获取到字符串的长度
        console.log(phoneNumber.length)
        if(phoneNumber.length==3){
            alert("手机号正确")
        }
        
    </script>
</head>
<body>
    
</body>
</html>